<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<head>
  <title>Title</title>
</head>
<body>
<h2>login</h2>
<form action="${pageContext.request.contextPath}/login" method="post">
  <label>用户名：</label><input type="text" name="username">
  <br><br>

  <label>密 码：</label><input type="password" name="password">
  <br><br>

  <img alt="验证码" src="/images/kaptcha.jpg" title="点击更换" id="img_captcha" onclick="javascript:refreshCaptcha();">
  <input type="text" name="captcha"><label>验证码</label>
  <a href="javascript:void(0)" onclick="javascript:refreshCaptcha()">看不清, 换一张</a>
  <br><br>

  <input type="checkbox" name="rememberMe"><label>记住我</label>
  <br><br>

  <input type="submit" value="提交">
</form>

<script type="text/javascript">
  function refreshCaptcha() {
    document.getElementById("img_captcha").src = "/images/kaptcha.jpg?t=" + Math.random();
  }
</script>
</body>
</html>
